<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>航天赛博博客管理系统</title>
    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/css/common.css">

    <style>
       table{
            width: 100%;
            border-collapse: collapse;
        }
        th{
            background-color: #bdbdbd;
            color: #fff;
        }
        th, td{
            text-align: center;
            border: 1px solid #b0b0b0;
            padding: 7px 5px;
            height: 30px;
        }
</style>
</head>
<body>
    <div id="div1">航天赛博博客管理系统</div>
    <div id="div2">
        <div id="left">
            <%@include file="menu.jsp"%>
        </div>
        <div id="right">
            <div class="content">
                <h2>查看所有博客</h2>
                <hr/>
                <p><input type="button" value="新增博客"
                          onclick="location.href='${pageContext.request.contextPath}/admin/add.jsp'">
                </p>

                <div class="data">
                    <table>
                        <tr>
                            <th>ID</th>
                            <th>标题</th>
                            <th>配图</th>
                            <th>发布时间</th>
                            <th>发布人</th>
                            <th>操作</th>
                        </tr>


                        <c:forEach items="${bList}" var="blog">
                                <tr>
                                    <td>${blog.id}</td>
                                    <td>
                                        <a href="${pageContext.request.contextPath}/admin/blog?id=${blog.id}">
                                            ${blog.title}
                                        </a>
                                    </td>
                                    <td>
                                        <img width="50" height="50" src="${pageContext.request.contextPath}${blog.imgUrl}" />
                                    </td>
                                    <td>${blog.createTime}</td>
                                    <td>${blog.username}</td>
                                    <td>
                                        <a href="${pageContext.request.contextPath}/admin/blog-edit-page?id=${blog.id}">
                                            修改
                                        </a>
                                        <a href="${pageContext.request.contextPath}/admin/blog-del?bid=${blog.id}">删除</a>
                                    </td>
                                </tr>
                        </c:forEach>

                    </table>
                </div>
            </div>
        </div>
        <div style="clear: both;"></div>
    </div>
    <div id="div3">Copyright 2019 @航天赛博</div>
</body>
</html>